<template>
  <div class="tjck">
    <div class="search">
      <div style="margin-left: 16px;margin-top: 10px;">
        <i class="el-icon-s-custom" ></i>体检查看
      </div>
      <div class="int">
          <el-date-picker
            style="width: 250px;height: 30px!important;"
            v-model="time"
            size="small"
            type="daterange"
            range-separator=" "
            start-placeholder="创建日期"
            end-placeholder="">
          </el-date-picker>
      </div>
      <div class="inquire">
        <el-button type="success" style="height: 30px;display: flex;align-items: center;float:left;margin-right: 20px">
          <i  class="el-icon-search"></i>
          查询</el-button>
        <el-button style="height: 30px;display: flex;align-items: center;">
          <i  class="el-icon-refresh"></i>
          重置</el-button>
      </div>
    </div>
    <div class="list">
      <el-table
        :data="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)"
        stripe
        style="width: 100%"
        :row-class-name="tableRowClassName">
        <el-table-column
          prop="createTime"
          label="上传时间"
          width="180"
          align="center"
        >
        </el-table-column>
        <el-table-column
          label=""
          width="1000%"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="operate"
          align="center"
          label="操作">
          <template slot-scope="scope">
          <i class="el-icon-zoom-in" style="margin-left: 20px;color: #4196ff; cursor:pointer;">查看</i>
          <i class="el-icon-delete" style="margin-left: 20px; color: #FD3236; cursor:pointer;" @click="omit(scope.$index,scope.row)">删除</i>
          </template>
        </el-table-column>
      </el-table>
      <div style="position: absolute;right: 20px;bottom: 60px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[3, 5, 10]"
          :page-size="pagesize"
          layout=" prev, pager, next,sizes, jumper"
          :total="tableData.length">
        </el-pagination>
      </div>
      <div class="reverseback" >
        <el-button type="success" style="width: 100px" @click="reverse">返回</el-button>
      </div>
    </div>
  </div>
</template>

<script>
  import {examine , omit} from "../../../api/Physical/Physical";

  export default {
  name: 'PatientManagement',
  data () {
    return {
      pickerOptions: {},
      time: '',
      currentPage: 1,
      pagesize: 10,
      labelPosition: 'right',
      tableData: []
    }
  },
    created(){
      this.examine()
    },
  methods: {
    //体检删除
    omit(index,row){
      console.log(row)
      omit({ids:row.mrid}).then(res=>{
        console.log('体检删除',res)
        this.examine()
      }).catch(err=>{
        console.log(err)
      })
    },
    //体检列表
    examine(){
      let data = this.$route.query.inspect
      console.log('体检列表参数',data)
      examine({custId:data}).then(res=>{
        console.log('体检列表',res)
        this.tableData = res.rows
      }).catch(err=>{
        console.log(err)
      })
    },
    reverse () {
      console.log('返回')
      this.$router.push('/Physical/Physical')
    },
    handleSizeChange (val) {
      this.pagesize = val
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange (val) {
      this.currentPage = val
      console.log(`当前页: ${val}`)
    },
    tableRowClassName ({ row, rowIndex }) {
      if (rowIndex === 1) {
        return 'warning-row'
      } else if (rowIndex === 3) {
        return 'success-row'
      }
      return ''
    }
  }
}
</script>

<style scoped lang="scss">
  .submit{
    width: 80px;
    height: 30px;
    background: #009945;
    border-radius: 4px;
    color: #ffffff;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
    float: left;
    cursor:pointer;
  }
  .cancel{
    width: 80px;
    float: left;
    height: 30px;
    border-radius: 4px;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
    border: 1px solid #EEEEEE;
    margin-left: 20px;
    cursor:pointer;
  }
  .redact{
    width: 600px;
    height: 580px;
    background: #FFFFFF;
    box-shadow: 0px 0px 32px 0px rgba(97,97,97,0.1);
    border-radius: 8px;
    position:fixed;
    top: 50%;
    left: 50%;
    margin-left: -300px;
    margin-top: -285px;
    z-index: 10;
    .title{
      width: 100%;
      height: 40px;
      background: #e7e5e5;
      /*background:red;*/
      border-radius: 8px 8px 0px 0px;
    }
  }
  .tjck{
    width: 97%;
    margin: 0 auto;
  }
  .search{
    width: 100%;
    height: 120px;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0px 4px 20px 0px rgba(51,51,51,0.08);
    margin-top: 20px;
  }
  .list{
    width: 100%;
    height: 680px;
    background: #ffffff;
    box-shadow: 0px 4px 20px 0px rgba(51,51,51,0.08);
    border-radius: 8px;
    margin-top: 20px;
    position: relative;
    /*.el-table .warning-row {*/
    /*  background: #fdf5e6;*/
    /*}*/

    /*.el-table .success-row {*/
    /*  background: #f0f9eb;*/
    /*}*/
    .reverseback{
      width: 60px;
      margin: 0 auto;
      text-align: center;
      position: absolute;
      bottom: 30px;
      left: 50%;
      transform: translate(-50% , -50%);
    }
  }
  .int{
    width: 25%;
    float: left;
    margin-top: 20px;
    margin-left: 20px;
  }
  .inquire{
    width: 30%;
    height: 50px;
    float: left;
    margin-top: 20px;
  }

</style>
